package thread.application;

import lombok.extern.log4j.Log4j2;

import static thread.api.utils.ThreadUtils.sleep;

/**
 * @author ykh
 */
@Log4j2
public class TongCou {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            log.debug("洗水壶");
            sleep(1);
            log.debug("烧开水");
            sleep(15);
        }, "老王");
        Thread t2 = new Thread(() -> {
            log.debug("洗茶壶");
            sleep(1);
            log.debug("洗茶杯");
            sleep(2);
            log.debug("拿茶叶");
            sleep(1);
            try {
                t1.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("泡茶");
        }, "小王");
        t1.start();
        t2.start();
    }
}
